﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace homework52
{
    class Program
    {
        static void Main(string[] args)
        {   //泛型约束
            List<int> arr = new List<int>();
            Random random = new Random();
            Console.Write("生成的随机数为：");
            Console.WriteLine();
            for (int i = 0; i < 100; i++)
            {
                arr.Add(random.Next(1000));
                Console.Write(arr [i] + " ");
            }
            
            Console.WriteLine();
            //降序排列
            var lik = from item in arr orderby item descending select item;
            Console.Write("降序排列如下：");
            Console.WriteLine();
            foreach (int i in lik )
            {
                Console.Write(i + " ");
            }
            Console.WriteLine();
            Console.WriteLine("最大值：" + lik.Max());
            Console.WriteLine("最大值：" + lik.Min());
            Console.WriteLine("和：" + lik .Sum());


        }
    }
}
